﻿<!DOCTYPE html>
<html>
	<head>
		<title>AGGREGATE Function</title>
		<meta charset="utf-8" />
		<meta name="description" content="" />
		<link type="text/css" rel="stylesheet" href="../../../../../../common/main/resources/help/editor.css" />
		<link type = "text/css" rel = "stylesheet" href = "../../images/sprite.css" />
        <script type="text/javascript" src="../callback.js"></script>
        <script type="text/javascript" src="../search/js/page-search.js"></script>
	</head>
	<body>
		<div class="mainpart">
            <div class="search-field">
                <input id="search" class="searchBar" placeholder="Search" type="text" onkeypress="doSearch(event)">
            </div>
			<h1>AGGREGATE Function</h1>
			<p>The <b>AGGREGATE</b> function is one of the <a href="../UsageInstructions/InsertFunction.htm#mathtrigonometry" onclick="onhyperlinkclick(this)">math and trigonometry functions</a>. The function is used to return an aggregate in a list or database. The <b>AGGREGATE</b> function can apply different aggregate functions to a list or database with the option to ignore hidden rows and error values.</p>
			<h3>Syntax</h3> 
			<p><b><em>AGGREGATE(function_num, options, ref1, [ref2], ...)</em></b></p> 
            <p>The <b>AGGREGATE</b> function has the following arguments:</p> 
            <table style="width: 40%">
                <tr>
                    <th style="background-color: #f4f4f4" width="150ch"><b>Argument</b></th>
                    <th style="background-color: #f4f4f4"><b>Description</b></th>
                </tr>
                <tr>
                    <td><b><em>function_num</em></b></td>
                    <td>A numeric value that specifies which function to use. The possible values are listed in the table below.</td>
                </tr>
                <tr>
                    <td><b><em>options</em></b></td>
                    <td>A numeric value that specifies which values should be ignored. The possible values are listed in the table below.</td>
                </tr>
                <tr>
                    <td><b><em>ref1</em></b></td>
                    <td>The first numeric value for which you want the aggregate value.</td>
                </tr>
                <tr>
                    <td><b><em>ref2</em></b></td>
                    <td>Up to 253 numeric values or a reference to the cell range containing the values for which you want the aggregate value. It is an optional argument.</td>
                </tr>
            </table>
			<p>The <b><em>function_num</em></b> argument can be one of the following:</p>
            <table style="width: 40%">
                <tr>
                    <th style="background-color: #f4f4f4"><b>function_num</b></th>
                    <th style="background-color: #f4f4f4"><b>Function</b></th>
                </tr>
                <tr>
                    <td><b><em>1</em></b></td>
                    <td><a href="../Functions/average.htm" onclick="onhyperlinkclick(this)">AVERAGE</a></td>
                </tr>
                <tr>
                    <td><b><em>2</em></b></td>
                    <td><a href="../Functions/count.htm" onclick="onhyperlinkclick(this)">COUNT</a></td>
                </tr>
                <tr>
                    <td><b><em>3</em></b></td>
                    <td><a href="../Functions/counta.htm" onclick="onhyperlinkclick(this)">COUNTA</a></td>
                </tr>
                <tr>
                    <td><b><em>4</em></b></td>
                    <td><a href="../Functions/max.htm" onclick="onhyperlinkclick(this)">MAX</a></td>
                </tr>
                <tr>
                    <td><b><em>5</em></b></td>
                    <td><a href="../Functions/min.htm" onclick="onhyperlinkclick(this)">MIN</a></td>
                </tr>
                <tr>
                    <td><b><em>6</em></b></td>
                    <td><a href="../Functions/product.htm" onclick="onhyperlinkclick(this)">PRODUCT</a></td>
                </tr>
                <tr>
                    <td><b><em>7</em></b></td>
                    <td><a href="../Functions/stdev-s.htm" onclick="onhyperlinkclick(this)">STDEV.S</a></td>
                </tr>
                <tr>
                    <td><b><em>8</em></b></td>
                    <td><a href="../Functions/stdev-p.htm" onclick="onhyperlinkclick(this)">STDEV.P</a></td>
                </tr>
                <tr>
                    <td><b><em>9</em></b></td>
                    <td><a href="../Functions/sum.htm" onclick="onhyperlinkclick(this)">SUM</a></td>
                </tr>
                <tr>
                    <td><b><em>10</em></b></td>
                    <td><a href="../Functions/var-s.htm" onclick="onhyperlinkclick(this)">VAR.S</a></td>
                </tr>
                <tr>
                    <td><b><em>11</em></b></td>
                    <td><a href="../Functions/var-p.htm" onclick="onhyperlinkclick(this)">VAR.P</a></td>
                </tr>
                <tr>
                    <td><b><em>12</em></b></td>
                    <td><a href="../Functions/median.htm" onclick="onhyperlinkclick(this)">MEDIAN</a></td>
                </tr>
                <tr>
                    <td><b><em>13</em></b></td>
                    <td><a href="../Functions/mode-sngl.htm" onclick="onhyperlinkclick(this)">MODE.SNGL</a></td>
                </tr>
                <tr>
                    <td><b><em>14</em></b></td>
                    <td><a href="../Functions/large.htm" onclick="onhyperlinkclick(this)">LARGE</a></td>
                </tr>
                <tr>
                    <td><b><em>15</em></b></td>
                    <td><a href="../Functions/small.htm" onclick="onhyperlinkclick(this)">SMALL</a></td>
                </tr>
                <tr>
                    <td><b><em>16</em></b></td>
                    <td><a href="../Functions/percentile-inc.htm" onclick="onhyperlinkclick(this)">PERCENTILE.INC</a></td>
                </tr>
                <tr>
                    <td><b><em>17</em></b></td>
                    <td><a href="../Functions/quartile-inc.htm" onclick="onhyperlinkclick(this)">QUARTILE.INC</a></td>
                </tr>
                <tr>
                    <td><b><em>18</em></b></td>
                    <td><a href="../Functions/percentile-exc.htm" onclick="onhyperlinkclick(this)">PERCENTILE.EXC</a></td>
                </tr>
                <tr>
                    <td><b><em>19</em></b></td>
                    <td><a href="../Functions/quartile-exc.htm" onclick="onhyperlinkclick(this)">QUARTILE.EXC</a></td>
                </tr>
            </table> 
			<p>The <b><em>options</em></b> argument can be one of the following:</p>
            <table style="width: 40%">
                <tr>
                    <th style="background-color: #f4f4f4"><b>Numeric value</b></th>
                    <th style="background-color: #f4f4f4"><b>Behavior</b></th>
                </tr>
                <tr>
                    <td><b><em>0 or omitted</em></b></td>
                    <td>Ignore nested <a href="../Functions/subtotal.htm" onclick="onhyperlinkclick(this)">SUBTOTAL</a> and AGGREGATE functions</td>
                </tr>
                <tr>
                    <td><b><em>1</em></b></td>
                    <td>Ignore hidden rows, nested <a href="../Functions/subtotal.htm" onclick="onhyperlinkclick(this)">SUBTOTAL</a> and AGGREGATE functions</td>
                </tr>
                <tr>
                    <td><b><em>2</em></b></td>
                    <td>Ignore error values, nested <a href="../Functions/subtotal.htm" onclick="onhyperlinkclick(this)">SUBTOTAL</a> and AGGREGATE functions</td>
                </tr>
                <tr>
                    <td><b><em>3</em></b></td>
                    <td>Ignore hidden rows, error values, nested <a href="../Functions/subtotal.htm" onclick="onhyperlinkclick(this)">SUBTOTAL</a> and AGGREGATE functions</td>
                </tr>
                <tr>
                    <td><b><em>4</em></b></td>
                    <td>Ignore nothing</td>
                </tr>
                <tr>
                    <td><b><em>5</em></b></td>
                    <td>Ignore hidden rows</td>
                </tr>
                <tr>
                    <td><b><em>6</em></b></td>
                    <td>Ignore error values</td>
                </tr>
                <tr>
                    <td><b><em>7</em></b></td>
                    <td>Ignore hidden rows and error values</td>
                </tr>
            </table>            
            <h3>Notes</h3>
            <p> If you want to use one of the following functions: <a href="../Functions/large.htm" onclick="onhyperlinkclick(this)">LARGE</a>, <a href="../Functions/small.htm" onclick="onhyperlinkclick(this)">SMALL</a>, <a href="../Functions/percentile-inc.htm" onclick="onhyperlinkclick(this)">PERCENTILE.INC</a>, <a href="../Functions/quartile-inc.htm" onclick="onhyperlinkclick(this)">QUARTILE.INC</a>, <a href="../Functions/percentile-exc.htm" onclick="onhyperlinkclick(this)">PERCENTILE.EXC</a>, or <a href="../Functions/quartile-exc.htm" onclick="onhyperlinkclick(this)">QUARTILE.EXC</a>, <b><em>ref1</em></b> must be a reference to the cell range and <b><em>ref2</em></b> must be the second argument that is required for these functions (<b><em>k</em></b> or <b><em>quart</em></b>).</p>
            <table style="width: 40%">
                <tr>
                    <th style="background-color: #f4f4f4"><b>Function</b></th>
                    <th style="background-color: #f4f4f4"><b>Syntax</b></th>
                </tr>
                <tr>
                    <td><a href="../Functions/large.htm" onclick="onhyperlinkclick(this)">LARGE</a></td>
                    <td>LARGE(array, k)</td>
                </tr>
                <tr>
                    <td><a href="../Functions/small.htm" onclick="onhyperlinkclick(this)">SMALL</a></td>
                    <td>SMALL(array, k)</td>
                </tr>
                <tr>
                    <td><a href="../Functions/percentile-inc.htm" onclick="onhyperlinkclick(this)">PERCENTILE.INC</a></td>
                    <td>PERCENTILE.INC(array, k)</td>
                </tr>
                <tr>
                    <td><a href="../Functions/quartile-inc.htm" onclick="onhyperlinkclick(this)">QUARTILE.INC</a></td>
                    <td>QUARTILE.INC(array, quart)</td>
                </tr>
                <tr>
                    <td><a href="../Functions/percentile-exc.htm" onclick="onhyperlinkclick(this)">PERCENTILE.EXC</a></td>
                    <td>PERCENTILE.EXC(array, k)</td>
                </tr>
                <tr>
                    <td><a href="../Functions/quartile-exc.htm" onclick="onhyperlinkclick(this)">QUARTILE.EXC</a></td>
                    <td>QUARTILE.EXC(array, quart)</td>
                </tr>
            </table>
            <p><a href="../UsageInstructions/InsertFunction.htm#applyfunction" onclick="onhyperlinkclick(this)">How to apply</a> the <b>AGGREGATE</b> function.</p>
			<h3>Examples</h3>
            <p>The figure below displays the result returned by the <b>AGGREGATE</b> function when the <b>SUM</b> function is applied.</p>
			<p><img alt="AGGREGATE Function" src="../images/aggregate.png" /></p>
            <p>The figure below displays the result returned by the <b>AGGREGATE</b> function when the <b>LARGE</b> function is applied, <b><em>ref1</em></b> is a reference to the cell range, and <b><em>k</em></b> is equal to 2. The function returns the second largest value in cells A1-A4.</p>
            <p><img alt="AGGREGATE Function" src="../images/aggregate2.png" /></p>
		</div>
	</body>
</html>